# """
# 增删改查的基类
#
# """
# from common.mixins import DictMixin
# from exts import db
# from copy import deepcopy
#
#
# class BaseService:
#     BASE_TABLE = None
#     # GET_BY_PAGE_QUERY = None
#
#     def create(self, **kwargs):
#         new_table = DictMixin.from_dict(self.BASE_TABLE, kwargs)
#         db.session.add(new_table)
#         db.session.commit()
#         return new_table
#
#     def get(self, table_id):
#         return self.BASE_TABLE.query.filter_by(id=table_id).first()
#
#     def get_by_page(self, **kwargs):
#         pass
#
#     def update(self, table_id, **kwargs):
#         table = self.BASE_TABLE.query.filter_by(id=table_id).first()
#         updated_table = DictMixin.from_dict(deepcopy(table), kwargs)
#         db.session.commit()
#         return updated_table
#
#     def delete(self, table_id):
#         table = self.BASE_TABLE.query.filter_by(id=table_id).first()
#         db.session.delete(table)
#         db.session.commit()
#         return table.id
